var tableData = {
	url : ctp + "/pieceQueryController/pieceQuerySearch.shtml",
	propertys : [ "NAME","JOBNO","GROUPNAME","WORKTYPE","PROJECT_NAME","BEGIN_DATE","END_DATE","PIECE_NUM","AUDIT_RESULTS"],
	 hrefs:[["function=details","recId=REC_ID","查看",null]],
	startLoad : function() {
		getListData(this);
	}
};
function searchData(curr) {
	setTagAndValue("form1", "curr", curr);
	tableData.startLoad();
}
$(document).ready(function() {
	$("#beginTime").val(setBeginTime());
	$("#endTime").val(setBeginTime());
	searchData();
	getWorkerType();
});

function setBeginTime(){
	var d = new Date();
	var year = d.getFullYear() + "";
	var month = d.getMonth() + 1;
	var date = d.getDate()+"";
	if(month < 10) month = "0" + month;
	if(date < 10) date = "0" + date;
	return year + "-" + month+"-"+date;
}

function details(recId) {
	location.href = ctp + "/pieceQueryController/goDetailPage.shtml?recId="+recId;
	
/*	layui.layer.open({
        type: 2,
        area: ['1000px', '550px'],
        title: "修改考勤排班",
        fixed: false,
        maxmin: false,
        content: ctp + "/attendanceController/attendanceUpdate.shtml?recId="+recId
    });*/
}

//导出系统用户
function exportConfirm(recId){
	var formSerialize =$("#form1").serialize();
	jconfirm("exportData('"+formSerialize+"')","确认要导出计件数据吗？");	
}
function exportData(formSerialize){
	location.href=ctp+"/pieceQueryController/exportPiece.shtml?"+formSerialize;
}


function getWorkerType() {
	$.ajax({
		url : ctp + "/sysdictController/getDictListByType.shtml",
		data : {
			dicType : 'WORKER_TP'
		},
		type : "POST",
		cache : false,
		dataType : "json",
		success : function(data) {
			var list = data.list;
			var $str = '';
			$str += '<option value="">全部</option>';
			for (var i = 0; i < list.length; i++) {
				var l = list[i];
				$str += '<option value="' + l.rec_value + '">' + l.rec_value
						+ '</option>';
			}
			$('#workeType').html($str);
		}
	});
}
